package com.dz.control;

import javax.xml.bind.SchemaOutputResolver;
import java.util.Scanner;

public class text {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        System.out.println("请输入：");
        int as[] = new int[10];
        int index = 0;
        int i=0;
        int s;
        while (sc.hasNext()) {

                s = sc.nextInt();
                as[i]=s;

            System.out.println(as[i]);
            i++;
            if(i==4){
                break;
            }
        }
        sc.close();
        int max;
        for (int o = as.length-1; i >0 ; i--) {
            for (int j=o-1;j>0;j--){
                if(as[o]<as[j]){
                    max=as[j];
                    as[j]=as[o];
                    as[o]=max;
                    index++;

                }
            }
        }
        System.out.println("index:"+index);


    }
    }

